home *** CD-ROM | disk | FTP | other *** search
/ Loadstar 162 / 162.d81 / psf.charter 2 (.txt) < prev    next >
Commodore BASIC  |  2022-08-26  |  7KB  |  305 lines

  1. 10 sys700
  2. 20 .opt oo
  3. 30 *=$7000
  4. 40 poi = $fb
  5. 50 chrout = $ffd2
  6. 99 ;-----------------------------------
  7. 100 jsr param ;1=commie 2,3,4,5=epson
  8. 110 tya
  9. 120 beq hop120 ;error
  10. 130 cmp #6
  11. 140 bcs hop120 ;error
  12. 150 cmp #1
  13. 160 beq hop160
  14. 170 sta epson25 ;save for sendctrl type
  15. 180 jmp doepson
  16. 190 hop160 jmp docommie
  17. 195 hop120 rts ;exit if # out of range
  18. 200 ;----------------------------------
  19. 210 param = * ;get parameter from basic
  20. 220 jsr $aefd
  21. 230 jsr $ad9e
  22. 240 jmp $b7f7 ;a=hb y=lb
  23. 300 ;----------------------------------
  24. 310 grab = * ;get byte at x0-39 y0-199
  25. 320 stx tempxdg
  26. 330 sty tempydg ;save these
  27. 340 lda #0
  28. 350 sta poi+1 ;hb=0
  29. 360 tya
  30. 370 and #%11111000 ;8*int(y/8)
  31. 380 asl:rol poi+1 ;*16
  32. 390 asl:rol poi+1 ;*32
  33. 400 asl:rol poi+1 ;*64
  34. 410 sta poi
  35. 420 sta templ64 ;(needed for *320 calc)
  36. 430 lda poi+1
  37. 440 sta temph64
  38. 450 asl poi:rol poi+1 ;*128
  39. 460 asl poi:rol poi+1 ;*256
  40. 470 clc
  41. 480 lda poi
  42. 490 adc templ64
  43. 500 sta poi ;add *256 & *64 to get *320
  44. 510 lda poi+1
  45. 520 adc temph64
  46. 530 sta poi+1
  47. 540 txa
  48. 550 asl:asl:asl ;8*cellx
  49. 560 php ;save if cellx>=32 status
  50. 570 clc
  51. 580 adc poi
  52. 590 sta poi ;add it
  53. 600 lda poi+1
  54. 605 adc #>8192 ;add bitmap's hb!
  55. 610 sta poi+1
  56. 620 plp
  57. 630 bcc hop630
  58. 640 inc poi+1 ;inc hb if cellx>=32
  59. 650 hop630 tya
  60. 660 and #7 ;add y and 7
  61. 670 clc
  62. 680 adc poi
  63. 690 sta poi
  64. 700 bcc hop700
  65. 705 inc poi+1
  66. 710 hop700 ldy #0
  67. 720 lda (poi),y ;*** get byte !!! ***
  68. 730 ldx tempxdg
  69. 740 ldy tempydg ;restore these
  70. 750 rts
  71. 800 ;----------------------------------
  72. 810 dorow1 = * ;do left 4 bits of col
  73. 820 ldy #199
  74. 830 lup920 jsr grab ;get byte
  75. 840 lsr:lsr:lsr:lsr
  76. 850 tay
  77. 860 lda fatline,y ;get byte for printer
  78. 870 jsr chrout ;and send it twice
  79. 875 jsr chrout
  80. 880 ldx tempxdg
  81. 890 ldy tempydg
  82. 900 dey
  83. 910 cpy #255 ;done column"?
  84. 920 bne lup920
  85. 930 rts
  86. 1000 ;[171][171][171][171][171][171][171][171][171][171][171][171][171][171][171][171][171][171][171][171][171][171][171][171][171][171][171][171][171][171][171][171][171]
  87. 1010 d[176]ow2 [178] [172] ;do right 4 bits of col
  88. 1020 ldy #199
  89. 1030 lup1120 jsr grab ;[161] byte
  90. 1040 [175] #15
  91. 1050 tay
  92. 1060 lda fatline,y ;[161] [153]er byte
  93. 1070 jsr chrout ;[175] s[128] it twice
  94. 1075 jsr chrout
  95. 1080 ldx tempxdg
  96. 1090 ldy tempydg
  97. 1100 dey
  98. 1110 cpy #255 ;d[145]e column"?
  99. 1120 bne lup1120
  100. 1130 rts
  101. 1200 ;---------------------------------
  102. 1210 sendctrl = * ;send control codes
  103. 1212 txa:pha
  104. 1220 ldx epson25 ;which driver 2-5"?
  105. 1230 ldy drivers[171]2,x ;(offsets)
  106. 1240 lup1280 lda allcodes,y
  107. 1250 beq hop1250
  108. 1260 jsr chrout ;s[128] [154]rol codes...
  109. 1270 iny
  110. 1280 jmp lup1280
  111. 1290 hop1250 pla:tax
  112. 1295 rts
  113. 1500 ;[171][171][171][171][171][171][171][171][171][171][171][171][171][171][171][171][171][171][171][171][171][171][171][171][171][171][171][171][171][171][171][171][171]
  114. 1510 doeps[145] [178] [172] ;[153] bitmap [145] eps[145]
  115. 1520 ldx #0
  116. 1530 lup1630 jsr s[128]ctrl ;graphics [145]
  117. 1540 jsr d[176]ow1 ;left 1[173]2 of column
  118. 1550 lda #13
  119. 1560 jsr chrout
  120. 1570 jsr s[128]ctrl ;graphics [145]
  121. 1580 jsr d[176]ow2 ;right 1[173]2 of column
  122. 1590 lda #13
  123. 1600 jsr chrout
  124. 1610 inx
  125. 1620 cpx #40 ;d[145]e entire screen"?
  126. 1630 bne lup1630
  127. 1640 rts
  128. 2000 ;---------------------------------
  129. 2010 docommie = * ;print bitmap on c=
  130. 2020 lda #0
  131. 2030 sta cur7pinx ;horiz b'map counter
  132. 2040 sta cur7pinx+1
  133. 2050 sta flip7pin ;if bit7 then pin 7 is single (else 1 is)
  134. 2100 lup2260 jsr column7 ;*** send column ***
  135. 2110 lda flip7pinx
  136. 2120 asl
  137. 2130 lda #3 ;add 3 or 4 to curpinx
  138. 2140 adc cur7pinx
  139. 2150 sta cur7pinx
  140. 2160 bcc hop2160
  141. 2170 inc cur7pinx+1
  142. 2180 hop2160 lda flip7pin
  143. 2190 eor #128 ;toggle pattern (1122334 to 1223344)
  144. 2200 sta flip7pin
  145. 2210 sec
  146. 2220 lda cur7pinx ;check if bitmap done
  147. 2230 sbc #<320
  148. 2240 lda cur7pinx+1
  149. 2250 sbc #>320
  150. 2260 bcc lup2260
  151. 2270 rts
  152. 2400 ;---------------------------------
  153. 2410 bytefor7 = * ;get byte from bitmap
  154. 2420 lda #7
  155. 2430 sta bitstodo ;7 bits for 7 pins
  156. 2440 lda cur7pinx
  157. 2450 sta peekx
  158. 2460 lda cur7pinx+1 ;for chekpeek
  159. 2470 sta peekx+1
  160. 2480 lda #0
  161. 2490 sta rorthis ;work byte
  162. 2500 lup2540 jsr chekpeek ;check bit
  163. 2510 ror rorthis
  164. 2520 jsr advance
  165. 2530 dec bitstodo ;done all"?
  166. 2540 bne lup2540
  167. 2550 sec
  168. 2560 r[176] r[176]this ;set bit 7 (c[178] [153]ers need this!)
  169. 2570 rts
  170. 2600 ;[171][171][171][171][171][171][171][171][171][171][171][171][171][171][171][171][171][171][171][171][171][171][171][171][171][171][171][171][171][171][171][171][171]
  171. 2610 advance [178] [172] ;inc [194]x properly
  172. 2620 bit flip7pin
  173. 2630 bmi hop2630 ;pattern [129] bit pairs
  174. 2640 lda bits[164]do
  175. 2650 lsr
  176. 2660 bcc hop2660
  177. 2670 rts
  178. 2700 hop2630 lda bits[164]do
  179. 2710 lsr
  180. 2720 bcs hop2660
  181. 2730 rts
  182. 2800 hop2660 inc [194]x
  183. 2810 bne hop2810
  184. 2820 inc [194]x[170]1
  185. 2830 hop2810 rts
  186. 2900 ;[171][171][171][171][171][171][171][171][171][171][171][171][171][171][171][171][171][171][171][171][171][171][171][171][171][171][171][171][171][171][171][171][171]
  187. 2910 s[128]ctr7 [178] [172] ;s[128] ctrlcodes [129] 7
  188. 2920 ldx #0
  189. 2930 lup2970 lda ctrl[129]7,x
  190. 2940 beq hop2940
  191. 2950 jsr chrout
  192. 2960 inx
  193. 2970 jmp lup2970
  194. 2980 hop2940 rts
  195. 3000 ;[171][171][171][171][171][171][171][171][171][171][171][171][171][171][171][171][171][171][171][171][171][171][171][171][171][171][171][171][171][171][171][171][171]
  196. 3010 column7 [178] [172] ;s[128] column [129] 7[171]pin
  197. 3020 jsr s[128]ctr7 ;graphic [145]
  198. 3030 lda #199
  199. 3040 sta [194]y
  200. 3050 lup3120 jsr byte[129]7 ;[161] byte
  201. 3060 lda r[176]this
  202. 3070 jsr chrout ;s[128] it twice
  203. 3080 jsr chrout
  204. 3090 dec [194]y
  205. 3100 lda [194]y
  206. 3110 cmp #255 ;d[145]e column"?
  207. 3120 bne lup3120
  208. 3130 lda #13 ;send carriage return
  209. 3140 jmp chrout ;(& rts)
  210. 3200 ;---------------------------------
  211. 3210 chekpeek = * ;sends bit-state @peekx/y back in carry
  212. 3220 lda #0
  213. 3230 sta poi+1 ;hb;0
  214. 3240 lda peeky
  215. 3250 lsr:lsr:lsr ;int (y/8)
  216. 3260 sta poi ;(save *1)
  217. 3270 asl:asl ;*4
  218. 3280 clc
  219. 3290 adc poi
  220. 3300 sta poi ;*5
  221. 3310 ldy #6
  222. 3320 lup3350 asl poi ;*10,*20,*40,*80,*160,*320
  223. 3330 rol poi+1
  224. 3340 dey
  225. 3350 bne lup3350
  226. 3360 clc
  227. 3370 lda peekx
  228. 3380 and #%11111000 ;8*int(x/8)
  229. 3390 adc poi
  230. 3400 sta poi
  231. 3410 lda poi+1
  232. 3420 adc peekx+1 ;hb ok as is
  233. 3430 sta poi+1
  234. 3440 clc
  235. 3450 lda peeky
  236. 3460 and #7
  237. 3470 adc poi ;(y and 7 for within cell)
  238. 3480 sta poi
  239. 3490 lda poi+1
  240. 3500 adc #>8192 ;add bitmap's hb
  241. 3510 sta poi+1
  242. 3520 lda peekx
  243. 3530 and #7 ;ready bit mask
  244. 3540 tax
  245. 3550 ldy #0
  246. 3560 lda (poi),y
  247. 3570 and bitmasks,x
  248. 3580 php ;*** save possible result ***
  249. 3590 sec
  250. 3600 lda peekx
  251. 3610 sbc #<320
  252. 3620 lda peekx+1
  253. 3630 sbc #>320
  254. 3640 bcc hop3640 ;ok - is in range
  255. 3650 plp
  256. 3660 clc ;out or range = always clear!
  257. 3670 rts
  258. 3700 hop3640 plp
  259. 3710 beq hop3710
  260. 3720 sec ;in range and set
  261. 3730 rts
  262. 3750 hop3710 clc ;in range and clear
  263. 3760 rts
  264. 5000 ;---------------------------------
  265. 5010 tempxdg .byte 0
  266. 5020 tempydg .byte 0
  267. 5030 templ64 .byte 0
  268. 5040 temph64 .byte 0
  269. 5050 epson25 .byte 0
  270. 5100 fatline = * ;double width nybbles!
  271. 5110 .byte %00000000
  272. 5120 .byte %00000011
  273. 5130 .byte %00001100
  274. 5140 .byte %00001111
  275. 5150 .byte %00110000
  276. 5160 .byte %00110011
  277. 5170 .byte %00111100
  278. 5180 .byte %00111111
  279. 5210 .byte %11000000
  280. 5220 .byte %11000011
  281. 5230 .byte %11001100
  282. 5240 .byte %11001111
  283. 5250 .byte %11110000
  284. 5260 .byte %11110011
  285. 5270 .byte %11111100
  286. 5280 .byte %11111111
  287. 5300 allcodes = * ;4 printer drivers
  288. 5310 d2 .byte 32,32,32,32,32,32,27,49,27,75,<400,>400,0
  289. 5320 d3 .byte 32,32,32,32,32,32,27,49,27,203,<400,>400,0
  290. 5330 d4 .byte 32,32,32,32,32,32,27,65,8,27,75,<400,>400,0
  291. 5340 d5 .byte 32,32,32,32,32,32,27,193,8,27,203,<400,>400,0
  292. 5350 drivers .byte d2-allcodes,d3-allcodes,d4-allcodes,d5-allcodes ;offsets
  293. 6000 ;---------------------------------
  294. 6010 peekx .byte 0,0
  295. 6020 peeky .byte 0
  296. 6030 cur7pinx .byte 0,0
  297. 6040 flip7pin .byte 0
  298. 6050 rorthis .byte 0
  299. 6060 bitstodo .byte 0
  300. 6200 bitmasks .byte 128,64,32,16,8,4,2,1 ;for chekpeek
  301. 6210 ctrlfor7 .byte 15,32,32,32,32,32,32,8,0 ;for 7-pin
  302. 63000 ;--------------------------------
  303. 63998 .end:end
  304. 63999 a$="psf.charter 2":open15,8,15,"s0:"+a$:close15:savea$,8
  305.